﻿
@{
    ViewBag.Title = "住院收入统计";
    Layout = "~/Views/Shared/_Index.cshtml";
}
<script src="@SiteUrl.GetStaticResourceScriptUrl("~/js/highcharts/highcharts.js")"></script>
<script src="@SiteUrl.GetStaticResourceScriptUrl("~/js/highcharts/modules/exporting.js")"></script>
<script>
    $(function () {
        loadChart();
    });

    function loadChart() {
        var OutpatientList = [];
        $.ajax({
            url: "/HighchartsManage/Inpatient/GetInpatientSalaryNum?r=" + Math.random(),
            dataType: "json",
            async: false,
            success: function (data) {
                if (data.data) {
                    OutpatientList = data.data;
                } else {
                    for (var i = 0; i < 12; i++) {
                        OutpatientList.push([0]);
                    }
                }
            }
        })
        $('#salarychart').highcharts({
            chart: {
                type: 'column'
            },
            title: {
                text: '住院收入统计'
            },
            xAxis: {
                categories: [
                    '一月',
                    '二月',
                    '三月',
                    '四月',
                    '五月',
                    '六月',
                    '七月',
                    '八月',
                    '九月',
                    '十月',
                    '十一月',
                    '十二月'
                ]
            },
            yAxis: {
                min: 0,
                title: {
                    text: '单位 (元)'
                }
            },
            tooltip: {
                valueSuffix: '元',
                headerFormat: "{point.key}:",
                pointFormat: '<tr><td>{point.y}<td></tr>',
                footerFormat: '</table>',
                shared: true,
                useHTML: true
            },
            plotOptions: {
                column: {
                    pointPadding: 0.2,
                    borderWidth: 0
                }
            },
            series: [{
                showInLegend: false,
                data: [
                        OutpatientList[0].num, OutpatientList[1].num, OutpatientList[2].num, OutpatientList[3].num, OutpatientList[4].num, OutpatientList[5].num, OutpatientList[6].num, OutpatientList[7].num, OutpatientList[8].num, OutpatientList[9].num, OutpatientList[10].num, OutpatientList[11].num
                ]
            }]
        });
    }
</script>
<div class="rows" style="margin-bottom: 1%; overflow: hidden;">
    <div style="float: left; width: 98%;">
        <div style="border: 1px solid #e6e6e6; background-color: #fff;">
            <div class="panel panel-default">
                <div class="panel-body" style="padding-bottom: 0px;">
                    <div id="salarychart" style="height: 440px; width: 100%; padding-right: 10px;"></div>
                </div>
            </div>
        </div>

    </div>

</div>
